package com.shunhe.zs_pda.util.http

import com.ruitu.router_module.Config
import com.shunhe.oa_web.net.http.HttpRes
import com.shunhe.zs_pda.base.Gl
import com.shunhe.zs_pda.model.LogCom
import com.shunhe.zs_pda.model.PageM
import com.shunhe.zs_pda.model.Site
import com.shunhe.zs_pda.model.User
import retrofit2.Call
import retrofit2.http.*

interface HttpApiService {

    companion object {
        const val OK = Config.OPEN_KEY
    }

    /****************************************/

    @FormUrlEncoded
    @POST("/api/user/login")
    fun login(
        @Field("account") account: String, @Field("password") password: String
    ): Call<HttpRes<User>>

    @GET("/api/logistics/logistics")
    fun reqLogComList(@Query("token") token: String = Gl.user!!.token): Call<HttpRes<ArrayList<LogCom>>>

    @FormUrlEncoded
    @POST("/api/logistics/addsite")
    fun reqAddSite(
        @Field("site_name") site_name: String, @Field("province_id") province_id: String,
        @Field("city_id") city_id: String, @Field("county_id") county_id: String,
        @Field("address") address: String, @Field("mobile") mobile: String,
        @Field("lat") lat: String, @Field("lng") lng: String,
        @Field("logistics_id") logistics_id: String = "",
        @Field("token") token: String = Gl.user!!.token
    ): Call<HttpRes<Any?>>

    @GET("/api/logistics/getsitelist")
    fun reqSite(
        @Query("logistics_id") logistics_id: String, @Query("token") token: String = Gl.user!!.token
    ): Call<HttpRes<PageM<Site>>>

    @FormUrlEncoded
    @POST("/api/logistics/addline")
    fun reqPubLine(
        @Field("origin") origin: String, @Field("destination") destination: String,
        @Field("receipt_site_ids") receipt_site_ids: String,
        @Field("unload_site_ids") unload_site_ids: String, @Field("manager_id") manager_id: String,
        @Field("logistics_id") logistics_id: String,
        @Field("type") type: String = "1", @Field("token") token: String = Gl.user!!.token
    ): Call<HttpRes<Any?>>

}